// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

namespace SnapObjects.Data.Oracle
{
    /// <summary>
    ///     Represents the options for the OracleDataContext object.
    /// </summary>
    public class OracleDataContextOptions : DataContextOptions
    {
        /// <summary>
        ///     Initializes a new instance of the OracleDataContextOptions class by passing the connection string as a parameter.
        /// </summary>
        /// <param name="connectionString">
        ///     A string containing connection information about how to connect to the data source.
        /// </param>
        public OracleDataContextOptions(string connectionString) :
            base(DatabaseType.Oracle)
        {
            this.ConnectionString = connectionString;

            this.InitialLOBFetchSize = -1;

            this.SuppressGetDecimalInvalidCastException = true;

            this.MapDateTimeAndTimeToTimeStamp = true;
        }

        /// <summary>
        ///     A string containing connection information about how to connect to the data source.
        /// </summary>
        public int InitialLongFetchSize { get; set; }

        public int InitialLOBFetchSize { get; set; }

        /// <summary>
        ///     It specifies whether to suppress the InvalidCastException and 
        ///     return a rounded-off 28 precision value if the Oracle NUMBER value has more than 28 precision.
        /// </summary>
        public bool SuppressGetDecimalInvalidCastException { get; set; }
        
        internal bool SPBindingByName { get; set; }
        internal bool MapDateTimeAndTimeToTimeStamp { get; set; }
    }

    /// <summary>
    ///     Represents the options for the OracleDataContext object.
    /// </summary>
    /// <typeparam name="TAdoDbContext"></typeparam>
    public class OracleDataContextOptions<TAdoDbContext> : OracleDataContextOptions, IDataContextOptions<TAdoDbContext>
    {
        /// <summary>
        ///     Initializes a new instance of the <see cref="OracleDataContextOptions{TAdoDbContext}"/> class by passing the connection 
        ///     string as a parameter.
        /// </summary>
        /// <param name="connectionString">
        ///     A string containing connection information about how to connect to the data source.
        /// </param>
        public OracleDataContextOptions(string connectionString) :
            base(connectionString)
        {
        }
    }
}
